<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
	<script type="text/javascript" src="resources/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<center>
	<h1>找回账号密码</h1>
	<hr>
	<form class="form-horizontal" >
 	 <div class="form-group">
    <label for="phone" class="col-sm-4 control-label">登陆名:</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" name="phone" id="phone" value="${account }" placeholder="请输入手机号……">
      <span id="p1" style="color:red"></span>
    </div>
  </div>
  
  
   <div class="form-group">
    <label for="phone" class="col-sm-4 control-label">验证码:</label>
    <div class="col-sm-2">
       <input type="text" class="form-control" id="phone"  name="verify" placeholder="请输入验证码……">
     			 <span id="p4" style="color:red"></span>
    </div>
    
    <div class="col-sm-1">
    		<input type="text" class="form-control" id="phone" name="code" value="${verificationCode }" disabled="disabled" placeholder="获取到的验证码">
    	</div>
    
    <div class="col-sm-1">
    		<a onclick="aa()" >看不清?换一张</a>
    	</div>
    
  </div>
  

  <div class="form-group">
    <div class="col-sm-offset-1 col-sm-10">
      		<button type="button" class="btn btn-warning"  style="width: 500px;height: 50px"  onclick="yz01()">立即验证</button>
    </div>
     
  </div>
</form>
</center>

<script type="text/javascript">
	function aa() {
		location.reload();
	}
	function yz01() {
		if($('[name="verify"]').val()!=$('[name="code"]').val()){
			$("#p4").html("验证码输入错误")
			return;
		}else{
			$("#p4").html("")
		} 
		if($('[name="phone"]').val()==null ||$('[name="phone"]').val()==''){
			$("#p1").html("not allowed to set a null value")
			return;
		}else{
			$("#p1").html("")
		}
		
		var phone=$('[name="phone"]').val();
		$.post("login",{phone:phone},function(flag){
			
			if(flag){
				alert("进入下一页")
				location="forgetPassword_2?phone="+phone;
			}else{
				$("#p1").html("用户名不存在")
			}
		},"json")
	}
	
</script>
</body>
</html>